home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / nerak2.zip / JOHN.SCR < prev    next >
Text File  |  1994-07-09  |  6KB  |  200 lines

  1. !
  2. ! John Script (Quester Character)
  3. !
  4. ! (c) DC Software, 1992
  5. !
  6.  
  7. !------------------------------------------------------------------------!
  8. :@TALK ! Talk to the character !
  9. !------------------------------------------------------------------------!
  10.  
  11.   if player.hp = 0 then
  12.     writeln( player.name, " is dead!" );
  13.     STOP;
  14.   endif;
  15.  
  16.   if npc.picture >= 0 then
  17.     viewpcx(npc);
  18.   endif;
  19.  
  20. ! No more quests?
  21.   if npc.v1 = 16 GOTO NOMORE;
  22.  
  23. ! Always talk to the leader of the pack..
  24.   group.current = 0;
  25.  
  26. ! Initialize the first time through..
  27.   if npc.v0 = 0 then
  28.     npc.v0 = 1;  ! We've talked, but no quest is pending..
  29.     npc.v1 = 0;  ! Do quest 0 first.
  30.   else
  31.     if npc.v0 = 2 goto QUEST; ! We already have a quest..
  32.   endif;
  33.  
  34. ! Select the item to be quested..
  35. :LOOP
  36.   setbp( npc, npc.v1 );
  37.   if npc.bp.count = 0 then
  38.     inc( npc.v1 );       ! The slot is empty, check the next one !
  39.     if npc.v1 = 16 
  40.        goto NOMORE;      ! We've got no more quests !
  41.     goto LOOP;
  42.   endif;
  43.  
  44. :START
  45.   writeln( "The McCoys think we've stolen their pig." );
  46.   writeln( "Now they won't let me marry Roseanna." );
  47.   writeln( "And both our families are fueding something awful.");
  48.   writeln( "Can you help me?");
  49.  
  50.   L1 = select( "Yes", "No", "Talk", "Bye" );
  51.   ON L1 GOTO QYES, QNO, CHAT, CSTOP;
  52.  
  53. :QYES
  54.   writeln( "I'll pay you ", $npc.bp.value, " if you bring me the ", npc.bp.name );
  55.   writeln( "Thank you and Good luck.." );
  56.   npc.v0 = 2; ! Quest Given
  57.   goto XSTOP;
  58.  
  59. :QNO
  60.   writeln( "Thanks for nothing then!" );
  61.   goto XSTOP;
  62.  
  63. !
  64. ! We HAVE a quest
  65. !
  66. :QUEST
  67.   setbp( npc, npc.v1 ); ! Select the quest that was given.. !
  68.   writeln( player.name, "! Have you brought me the ", npc.bp.name, "?" );
  69.   voice( "Quest" );
  70.  
  71.   L1 = select( "Yes", "No", "Talk", "Bye" );
  72.   on L1 goto CYES, CNO, CHAT;
  73.   goto CSTOP;
  74.  
  75. :CYES
  76.  
  77. ! Find out WHO has the item
  78.   L2 = find( player, npc.bp.name );
  79.   if L2 < 0 then 
  80.     ! No one, so find out if the object is a person..
  81.     L2 = find( group, npc.bp.name );
  82.     if L2 < 0 goto NOTHERE;
  83.   endif;
  84.  
  85.   group.current = L2;
  86. ! If the player's name matches the backpack name, its a RESCUE !
  87.   if player.name = npc.bp.name then
  88.     writeln( "Ellie! I'm so glad you're found!" );
  89.     ! 
  90.     ! When the rescued person leaves the party, take the following actions
  91.     !
  92.     player.v1 = 2;              ! 1 when I join the party.  2 on delivery! 
  93.     if( player.text >= 0 ) then
  94.       inc( player.text );       ! Change text block (if any)
  95.     endif;
  96.     if( player.voice >= 0 ) then
  97.       inc( player.voice );      ! Change voice file (if any)
  98.     endif;
  99.     if( player.picture >= 0 ) then
  100.       inc( player.picture );    ! Change picture file (if any)
  101.     endif;
  102.     player.type = CIVILIAN;     ! No longer a prisoner !
  103.     ! Place the player at next to the NPC (quester)
  104.     leave( player.index, npc.x+1, npc.y ); ! Remove from the party
  105.     group.current = 0;
  106.   else
  107.     ! Otherwise, the quested item is in the player's backpack.
  108.     L2 = find( player.bp, npc.bp.name, npc.bp.type );
  109.     if L2 < 0 GOTO NOTHERE;
  110.     vanish( player.bp );
  111.   endif;
  112.  
  113.   npc.v0 = 1;     ! No quest pending, but we already met
  114.   inc(npc.v1);    ! Increment backpack index for next quest (if any)
  115.  
  116.   ! Now give a reward..
  117.   inc( group.gold, npc.bp.value );               ! Pay for it !
  118.   writeln( $npc.bp.value, " is the reward.  Here it is." );
  119.  
  120.   if npc.bp.weight > 0 then
  121.     L4 = npc.bp.weight;                          ! Experience is given here !
  122.   else
  123.     L4 = npc.bp.value / 10 * (random(3)+1) + 1;  ! Give random experience !
  124.   endif;
  125.  
  126. ! Do the whole party..
  127.   foreach player do
  128.     inc( player.exp, L4 );    ! Level promotions are automatic !
  129.   endfor;
  130.  
  131. viewpcx ("pig.pcx");
  132. wait    (  120    );
  133.  
  134.   if npc.bp.endgame = END_ON_GIVE then
  135.     if npc.bp.endtext > 0 then
  136.       readtext( npc.bp.endtext );
  137.     endif;
  138.     ENDGAME;
  139.   endif;
  140.  
  141. :CSTOP
  142.   writeln( "May the force be with you." );
  143.   goto XSTOP;
  144.  
  145. :CNO
  146.   writeln( "Why are you back then?" );
  147.   GOTO CHAT1;
  148.  
  149. !
  150. ! Conversation is optional for a quester, but this one likes to chat..
  151. !
  152. :CHAT
  153.   writeln( "What would you like to talk about?" );
  154.  
  155. :CHAT1
  156.   L3 = getstr("Name","Where","Quest","Bye");
  157.  
  158. ! First, see if the keyword typed is in the character's text block !
  159.   if dotext( S0 ) then
  160.     if L3 = 3 goto XSTOP;
  161.     goto CHAT1;
  162.   endif;
  163.  
  164. ! It didn't, so try the predefined ones..
  165.   on L3 goto CName, WHERE, START, CSTOP;
  166.  
  167. ! Nope, try a 'DEFAULT' line
  168.   if not dotext( "DEFAULT" ) then
  169.     writeln( "I don't know anything about that!" );
  170.   endif;
  171.   goto CHAT1;
  172.  
  173. :CName
  174.   writeln( "My name is ", npc.name, "."        );
  175.   GOTO CHAT1;
  176.  
  177. :WHERE
  178.   writeln( "If I knew where, I wouldn't need your services!" );
  179.   GOTO CHAT1;
  180.  
  181. :NOMORE
  182.   writeln( "Sorry, I have no more quests." );
  183.   goto XSTOP;
  184.  
  185. :NOTHERE
  186.   writeln( "You don't have the ", npc.bp.name, " with you." );
  187.   writeln( "Are you sure you found it?" );
  188.   L3 = select( "Yes", "No", "Maybe", "What", "Who", "Ugh..", "Bye" );
  189.   writeln( "Hmm..  Come back when you find it.." );
  190.   goto XSTOP;
  191.  
  192. !-----------------------------------------------------------------!
  193. ! All STOPs now lead here so the screen can be restored if needed !
  194. !-----------------------------------------------------------------!
  195. :XSTOP
  196.   if npc.picture >= 0 then
  197.     paint(window); ! Assumes the picture fits in the window !
  198.   endif;
  199.   STOP;
  200.